<%@page contentType="text/html;charset=UTF-8"%> 
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>

<style>
<!--
	.selected {
    background-color: #f5f5f5;
}
-->
</style>
<script type="text/javascript">
$(document).ready(function(){
	$("#table #rows").click(function(){
		   $(this).addClass('selected').siblings().removeClass('selected');    
		   var idphieubaonghi = $(this).find('td:eq(0)').html();
		  	$('#idphieubaonghi').val(idphieubaonghi);
		  	$('#btnDelete').attr('href', 'xoabaonghi/'+idphieubaonghi);
 
		  })
});	
</script>




<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".baonghi">Thêm</button>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".baobu">Thêm báo bù</button>
<!-- MODAL THEM BAO NGHI -->
<div class="modal fade baonghi" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-lg">
		<div class="modal-content">
			<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
			<h4 class="modal-title" id="myModalLabel">Thêm phiếu báo nghỉ</h4>
			</div><!--end .modal-header  -->
			<div class="modal-body">
				<form action="thembaonghi" method="post" class="form-horizontal" accept-charset="UTF-8">
					<div class="form-group">
						<label for="tuan" class="col-lg-3 control-label">Tuần</label>
						<div class="col-lg-9">
						<input class="form-control" id="tuan" name="tuan" placeholder="Tuần" type="text">
					</div>
					</div><!-- end form-group-->
					<div class="form-group">
						<label for="ngay" class="col-lg-3 control-label">Ngày</label>
						<div class="col-lg-9">
						  <input class="form-control" name="ngay" type="text" id="datepicker" placeholder="Ngày" >
						</div>
					</div><!-- end form-group-->
					<div class="form-group">
						<label for="tuan" class="col-lg-3 control-label">Môn học</label>
						<div class="col-lg-9">
						<input class="form-control" id="monhoc" name="monhoc" placeholder="Môn học" type="text">
					</div>
					</div><!-- end form-group-->
					<div class="form-group">
						<label for="tuan" class="col-lg-3 control-label">Tiết</label>
						<div class="col-lg-9">
						<input class="form-control" id="tiet" name="tiet" placeholder="Tiết" type="text">
					</div>
					</div><!-- end form-group-->
					<div class="form-group">
						<label for="tuan" class="col-lg-3 control-label">Số tiết</label>
						<div class="col-lg-9">
						<input class="form-control" id="sotiet" name="sotiet" placeholder="Số tiết" type="text">
					</div>
					</div><!-- end form-group-->
					<div class="form-group">
						<label for="ghichu" class="col-lg-3 control-label">Lý do</label>
						<div class="col-lg-9">
						<textarea class="form-control" rows="3" id="lydo" name="lydo" placeholder="Lý do"></textarea>
						</div>
					</div><!-- end form-group-->

					<button type="button" class="btn btn-default" data-dismiss="modal">Đóng</button>
					<button type="submit" class="btn btn-primary">Lưu</button>
					
				</form><!-- end form -->
			</div><!-- END modal-body -->
		
		</div><!-- end .modal-content -->
	</div><!--end .modal-dialog modal-lg -->
</div><!-- end .modal fade bs-example-modal-lg -->
<!-- END MODAL THEM BAO NGHI-->

<!-- MODAL THEM BAO BU -->
<div class="modal fade baobu" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-lg">
		<div class="modal-content">
			<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
			<h4 class="modal-title" id="myModalLabel">Thêm Lịch Làm Việc</h4>
			</div><!--end .modal-header  -->
			<div class="modal-body">
				<form action="thembaobu" method="post" class="form-horizontal" accept-charset="UTF-8">
					<div class="form-group">
						<label for="tuan" class="col-lg-3 control-label">Mã phiếu báo nghĩ</label>
						<div class="col-lg-9">
						<input class="form-control" id="idphieubaonghi" name="idphieubaonghi" type="text">
					</div>
					</div><!-- end form-group-->
					<div class="form-group">
						<label for="tuan" class="col-lg-3 control-label">Sỉ số</label>
						<div class="col-lg-9">
						<input class="form-control" id="siso" name="siso" type="text">
					</div>
					</div><!-- end form-group-->
					<div class="form-group">
						<label for="ngay" class="col-lg-3 control-label">Ngày bù</label>
						<div class="col-lg-9">
						  <input class="form-control" name="ngaybu" id="datepicker_baobu">
						</div>
					</div><!-- end form-group-->
					
					<button type="button" class="btn btn-default" data-dismiss="modal">Đóng</button>
					<button type="submit" class="btn btn-primary">Lưu</button>
					
				</form><!-- end form -->
			</div><!-- END modal-body -->
		
		</div><!-- end .modal-content -->
	</div><!--end .modal-dialog modal-lg -->
</div><!-- end .modal fade bs-example-modal-lg -->
<!-- END MODAL THEM BAO BU-->

<!-- MODAL  SUA BAO NGHI -->
<div class="modal fade s" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Sửa chi tiết phân công</h4>
</div>
<div class="modal-body">
	<form action="/QLKhoaCNTT/capnhatphancong"  method="post" class="form-horizontal" accept-charset="UTF-8">
		<div class="form-group">
				<label for="idphancong" class="col-lg-3 control-label">ID Phân công</label>
				<div class="col-lg-9">
				<input class="form-control" id="idphancong" name="idphancong" readonly type="text">
				</div>
			</div><!-- end form-group-->
		<div class="form-group">
			<label for="idcongvan" class="col-lg-3 control-label">Ký hiệu công văn</label>
			<div class="col-lg-9">
			<input class="form-control" id="idcongvan" name="idcongvan" readonly type="text">
			</div>
		</div><!-- end form-group-->

		<div class="form-group">
			<label for="trichYeu" class="col-lg-3 control-label">GV/BM được phân công</label>
			<div class="col-lg-9">
			<input class="form-control" id="duocphancong" name="idcongvan" readonly type="text">
			</div>
		</div>
		
		<div class="form-group">
			<label for="ngayNhan" class="col-lg-3 control-label">Người phân công</label>
			<div class="col-lg-9">
			 <input class="form-control" type="text" id="nguoiphancong" readonly>
			</div>
		</div><!-- end form-group-->
		
		<div class="form-group">
			<label for="ngayNhan" class="col-lg-3 control-label">Ngày phân công</label>
			<div class="col-lg-9">
			 <input class="form-control" type="text" id="ngayphancong" readonly>
			</div>
		</div><!-- end form-group-->
		
		<div class="form-group">
			<label for="ngayNhan" class="col-lg-3 control-label">Hạn chót</label>
			<div class="col-lg-9">
			 <input class="form-control" type="text" name="hancuoi" id="datepicker_hanchot">
			 <div class="checkbox">
          <label>
            <input type="checkbox" id="xacnhanhoantat" name="xacnhanhoantat" readonly> Xác nhận hoàn tất
          </label>
        </div>
        <div class="checkbox">
          <label>
            <input type="checkbox" id="xacnhanbcn" name="xacnhanbcn"> Xác nhận BCN
          </label>
        </div>
			</div>
		</div><!-- end form-group-->

		<button type="button" class="btn btn-default" data-dismiss="modal">Đóng</button>
		<button type="submit" class="btn btn-primary">Lưu</button>

	</form>

</div><!-- END modal-body -->
</div><!-- END modal-content -->
</div><!-- END modal-dialog modal-lg -->
</div><!-- END modal fade bs-example-modal-lg -->
<!-- END MODAL SUA BAO NGHI-->

<!-- MODAL XOA BAO NGHI -->
<div class="modal fade" id="delete" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Xóa phiếu báo nghỉ</h4>
</div>
<div class="modal-body">
	<p style="color: red;">Bạn có chắc muốn xóa không !!!</p>
</div><!-- END modal-body -->
<div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">Hủy</button>
    <a class="btn btn-primary" id="btnDelete" >Xóa</a>
</div>
</div><!-- END modal-content -->
</div><!-- END modal-dialog modal-lg -->
</div><!-- END modal fade bs-example-modal-lg -->
<!-- END MODAL XOA BAO NGHI-->

<c:if test="${!empty listPhieuBaoNghi}">
	<table class="table table-hover" id="table">
		<tr>
			<th width="80">Mã phiếu</th>
			<th width="80">Tuần</th>
			<th width="80">Ngày</th>
			<th width="120">Môn học</th>
			<th width="120">Tiết</th>
			<th width="120">Số tiết</th>
			<th width="120">Lý do</th>
			<th width="120">Xác nhận</th>
			<th width="120">Sửa</th>
			<th width="120">Xóa</th>
			
		</tr>
		<c:forEach items="${listPhieuBaoNghi}" var="baonghi">
			<tr id="rows">
				<td>${baonghi.idPhieu}</td>
				<td>${baonghi.phieudangky.tuan}</td>
				<td>${baonghi.phieudangky.ngay}</td>
				<td>${baonghi.monHoc}</td>
				<td>${baonghi.phieudangky.tiet}</td>
				<td>${baonghi.phieudangky.soTiet}</td>
				<td>${baonghi.phieudangky.lyDo}</td>
				<c:choose>
					<c:when test="${baonghi.phieudangky.xacNhan == 1}">
						<td><input type="checkbox" id="xacnhan_tb" checked/></td>
					</c:when>
					<c:otherwise>
						<td><input type="checkbox" id="xacnhan_tb" /></td>
					</c:otherwise>
				</c:choose>
				<td><button type="button" class="btn btn-primary" data-toggle="modal" data-target=".s">Sửa</button></td>
				<td><a class="btn btn-primary" data-toggle="modal" href="#delete">Xóa</a></td>
				<td><a class="btn btn-primary" href="QLKhoaCNTT/downloadPDF">In</a></td> 
			 </tr>
		</c:forEach>
	</table>
</c:if>

